<?php

namespace App\Http\Controllers\WAP\User;

use App\Http\Service\User\UserService;
use Illuminate\Http\Request;
use Session,Config;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Http\Service\Product\ProductService;

class IndexController extends Controller
{
    //

    protected  $index = 'WAP.User.index';
    protected  $set = 'WAP.User.set';
    protected  $invite = 'WAP.User.invite';

    /**
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     * 个人中心
     */
    public function index()
    {
        $title='我的';
        $token = Session::get(Config::get('custom.setting.MEMBER_TOKEN'));

        $where['token'] = $token;
        return view($this->index)->with('title',$title);

    }

    /**
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     * 设置
     */
    public function set()
    {
    	$title='账号管理';
        $token = Session::get(Config::get('custom.setting.MEMBER_TOKEN'));
        $where['token'] = $token;
        $user = new UserService();
        $arr =  $user->Setting($where);

        if($arr['code'] == '0')
        {
            $data = $arr['data'];
        }else{
            $data = [];
        }
//        dd($data);
        return view($this->set)->with('data',$data)->with('title',$title);
    }


    /**
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     *邀请
     */
    public function invite()
    {
    	$title='邀请好友';
        return view($this->invite)->with('title',$title);
    }


    // 客服

    public function KeFuqq(Request $request)
    {
        $where = [];
        $where = $request->all();
        $where['ip'] = $_SERVER["REMOTE_ADDR"];
        $user = new UserService();
        $arr =  $user->KeFuqq($where);
    }

    //   获取客服
    public function getTeamqq()
    {
        $user = new UserService();
        $data = $user->getTeamqq();
        $qq =[];

        if($data['code'] == 0)
        {
            if(!empty($data['data']))
            {
                $qq = $data['data']['qq'];
            }
        }

//        $qq = implode(',',$qq);
//        dd($qq);

        return $qq;
    }



    public function sendCode()
    {
        echo '111111';
    }


}
